package static关键字的使用;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import 数据类型.求面积.Cirecle;

/*
* static的关键字的应用
* */
public class CircleTest {
    public static void main(String[] args) {
        Circle circle = new Circle();
        Circle circle1 = new Circle(3.4);
        Circle circle2=new Circle();
        System.out.println(circle.getId());
        System.out.println(circle2.getId());
        System.out.println(Circle.getTotal());
    }

}
@AllArgsConstructor
@Setter
@Getter
class Circle{

    private double radious;
    private int id;
    private static int total;//记录圆的个数
    private static int init=1001;//static 声明的属性被所有对象所共享
    public Circle(){
        id =init++;
        total++;
    }
    public Circle(double radious){
        this();
    }
    public double finaDrea(){
        return Math.PI * radious * radious;
    }
    public static int getTotal(){
        return total;
    }
}